

public class Camion extends Thread
{
	static final int nbVelosDepart = 5;
	
	private int nbVelosDansCamion;
	private Site[] sites;

	public Camion (Site[] s)
	{
		this.nbVelosDansCamion = nbVelosDepart;
		this.sites = s;	
		this.setDaemon(true);
	}
	
	public void run ()
	{	

		while (true)
		{
			for(int i = 0; i<sites.length; i++)
			{
				for(int j = 0; j<sites.length; j++)
				{
					System.out.println ("# site n° " + j + " : nbVelos = " + sites[j].getNbVelos());
				}
			nbVelosDansCamion = sites[i].passageCamion(nbVelosDansCamion);
			System.out.println("++Je depose au site " + i +" je suis le camion youhouh");
			try { sleep(1000); } catch(InterruptedException e) {}
			System.out.println ();
			}
		}
	}
}
